﻿#pragma once

#include "Ability/EditorAbilityModel.h"
#include "Path/Path.h"

#include "EditorFolderAbilityModel.m.h"

RCLASS()
class REditorFolderAbilityModel : public REditorAbilityModel
{
    ROBJECT

public:
    virtual void FirstTimeInitializeObject() override;

    virtual CString GetName() const override;
    SPath GetRootFolder() const;
    void SetRootFolder(const SPath& InRootFolder);
    TDelegate<void> OnRootFolderChanged;

    TVector<SPath> GetOpenedFolders() const;
    void CloseFolder(const SPath& InFolder);
    void CloseAllFolders();
    void OpenFolder(const SPath& InFolder);
    bool IsFolderOpened(const SPath& InFolder) const;
    TDelegate<void,const SPath& /*Folder*/, bool /*is open*/ > OnFolderOpenStateChanged;
protected:
    RFIELD()
    SPath RootFolder;

    RFIELD()
    TVector<SPath> OpenedFolders;

    RFUNCTION()
    void OnProjectOpened();

};
